﻿<Page x:Class="Halfwit.Views.LoginPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
	Title="Connection">
    <Page.Resources>
        <Style TargetType="Button" BasedOn="{StaticResource {x:Type ButtonBase}}">
            <Setter Property="Margin" Value="4,0,0,0" />
            <Setter Property="Width" Value="65" />
        </Style>
    </Page.Resources>
    
    <DockPanel>
        <DockPanel DockPanel.Dock="Bottom" Margin="8,16,8,8" LastChildFill="False">
            <Button DockPanel.Dock="Right" Content="Cancel" IsCancel="True" Command="{Binding Cancel}" />
            <Button DockPanel.Dock="Right" Content="OK" IsDefault="True" Command="{Binding Save}" />
        </DockPanel>

        <TextBlock DockPanel.Dock="Top" Text="Connection" FontSize="16" Margin="8,2" />

        <StackPanel Margin="8" MaxWidth="480">
            <GroupBox Header="Authentication" Margin="0,0,0,16" Padding="8" >
                <StackPanel>
                    <TextBlock TextWrapping="Wrap">Halfwit Uses OAuth to authenticate with Twitter. Click the button below to launch your web browser and sign in, then enter the PIN supplied by Twitter below.</TextBlock>

                    <Button 
                        Command="{Binding RequestPin}" 
                        Content="_Request PIN"
                        Margin="8"
                        Padding="8,0"
                        HorizontalAlignment="Center" 
                        VerticalAlignment="Center" 
                        Width="Auto" />

                    <Label 
                        x:Name="pinLabel"
                        Target="{Binding ElementName=pinEdit}"
                        Content="_PIN" />
                    <TextBox 
                        x:Name="pinEdit"
                        Text="{Binding Pin,UpdateSourceTrigger=PropertyChanged}"
                        />
                </StackPanel>
            </GroupBox>
        </StackPanel>
    </DockPanel>
</Page>
